package enumandlambda;

/**
 * @author shkstart
 * @create 2022-12-06-13:35
 */
public class WaitDemo {
    public static void main(String[] args) {

        Object lock = new Object();
        Thread t1 = new Thread(()->{
            System.out.println("线程1 开始执行");
            synchronized(lock){
                System.out.println("线程1  调用wait方法...");
                try {
//                    无限等待
                    lock.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"线程1");
        t1.start();
    }
}
